from django.db import models
from dingxiang.utils.models import BaseModel
# Create your models here.

from AskDoctor.models import DoctorModel

# 手术分类
class SurgicalClassification(BaseModel):
    examination_name = models.CharField(max_length=100, null=True, blank=True, verbose_name='分类名称')
    class Meta:
        verbose_name = 'surgical_classification'
        verbose_name_plural = '手术分类'

    def __str__(self):
        return self.examination_name

# 手术详情
class SurgicalDetails(BaseModel):
    title = models.CharField(max_length=255, null=True, blank=True, verbose_name="标题")
    department = models.CharField(max_length=20, null=True, blank=True, verbose_name='科室')
    entry_author = models.CharField(max_length=20, null=True, blank=True, verbose_name='词条作者')
    review_experts = models.CharField(max_length=20, null=True, blank=True, verbose_name='审核专家')
    publish_date = models.DateField(auto_now_add=True, null=True, blank=True, verbose_name="发布时间")
    content = models.TextField(verbose_name="内容", null=True, blank=True)
    indications = models.TextField(verbose_name='适应证', null=True, blank=True)
    contraindications = models.TextField(verbose_name='禁忌证', null=True, blank=True)
    complications = models.TextField(verbose_name='并发症', null=True, blank=True)
    attention = models.TextField(verbose_name='注意事项', null=True, blank=True)
    preoperative_precautions = models.TextField(verbose_name='术前注意事项', null=True, blank=True)
    intraoperative_precautions = models.TextField(verbose_name='术中注意事项', null=True, blank=True)
    postoperative_precautions = models.TextField(verbose_name='术后注意事项', null=True, blank=True)
    Interpretation_results = models.TextField(verbose_name='结果解读', null=True, blank=True)
    more_information = models.TextField(verbose_name='更多信息', null=True, blank=True)
    classification = models.ForeignKey(SurgicalClassification, on_delete=models.DO_NOTHING, null=True, related_name="classification_details", verbose_name='手术分类')

    class Meta:
        verbose_name = 'surgical_details'
        verbose_name_plural = '手术详情'

    def __str__(self):
        return self.title
